#include <stdio.h>
#include <stdlib.h>
typedef struct stack
{
    int data[20];
    int index;
}stack;
stack *init(){
    stack *s=malloc(sizeof(stack));
    s->index=-1;
    return s;
}
int isempt(stack s){
    int flage=0;
    if(s.index==-1) flage=1;
    return flage;
}
int isfull(stack s){
    int flage=0;
    if(s.index==19) flage=1;
    return flage;    
}
void push(stack *s,int data){
    if(isfull(*s)==1){
        printf("这个已经满了");
    }
    else{
        s->data[++s->index]=data;
    }
}
int pop(stack *s){
    int data;
    if (isfull(*s)==1)
    {
        data=0;
    }
    else{
        data=s->data[s->index--];
    }
}

void main(){
    stack *s=init();
    int n;
    while(1==1)
    {
        printf("输入一个数给这个栈");
        scanf("%d",&n);
        if(n==0) break;
        push(s,n);
    }
    while (isempt(*s)==0)
    {
       printf("%d\n",pop(s));
    } 
}